/**
 * 搜索是否需要精确
 * @author rxliuli
 */
Vue.component('rx-search-action', {
    model: {
        prop: 'value',
        event: 'change',
    },
    props: {
        value: {
            type: [Number, String]
        },
        name: {
            type: String,
            default: () => `rx-search-action-${rx.autoIncrement()}`,
        },
    },
    data() {
        return {
            actions: fieldFormatter.form.action,
        }
    },
    computed: {
        innerValue: {
            get() {
                if (!this.value) {
                    return 0;
                }
                return parseInt(this.value)
            },
            set(val) {
                this.$emit('change', val)
            },
        },
    },
    template: `
        <el-radio-group v-model="innerValue">
            <el-radio v-for="[id,name] in actions" :key="id" :label="id">{{name}}</el-radio>
        </el-radio-group>
`,
})
